﻿using Prism.Commands;
using Prism.Mvvm;
using System.Collections.ObjectModel;

namespace BlankApp1.ViewModels
{
    public class MainWindowViewModel : BindableBase
    {
        private string _title = "Prism Application";
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        private ObservableCollection<string> fieldName;
        public ObservableCollection<string> FieldName
        {
            get { return fieldName; }
            set { SetProperty(ref fieldName, value); }
        }

        private ObservableCollection<MyClass> myClasses;
        public ObservableCollection<MyClass> MyClasses
        {
            get { return myClasses; }
            set { SetProperty(ref myClasses, value); }
        }

        public MainWindowViewModel()
        {
            fieldName = new ObservableCollection<string>();
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");
            fieldName.Add("1");
            fieldName.Add("2");
            fieldName.Add("3");
            fieldName.Add("4");


            myClasses =new ObservableCollection<MyClass>();
            myClasses.Add(new MyClass() { Index=1, MyList= fieldName });
            myClasses.Add(new MyClass() { Index = 2, MyList = fieldName });
            myClasses.Add(new MyClass() { Index = 3, MyList = fieldName });




        }

        private DelegateCommand _fieldName;
        public DelegateCommand CommandName =>
            _fieldName ?? (_fieldName = new DelegateCommand(ExecuteCommandName));

        void ExecuteCommandName()
        {

        }
    }

   public class MyClass:BindableBase
    {
        private int index;
        public int Index
        {
            get { return index; }
            set { SetProperty(ref index, value); }
        }

        private ObservableCollection<string> myList;
        public ObservableCollection<string> MyList
        {
            get { return myList; }
            set { SetProperty(ref myList, value); }
        }
    }
}
